﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmartSpace.Core;

namespace SmartSpace.Data.AutoInput
{
    /// <summary>
    /// 
    /// </summary>
    public class CreateDateTimeConvertor : IDataConvertor
    {
        public object Convert(string value)
        {
            return System.Convert.ToDateTime(value);
        }

        public string Convert(object value)
        {
            return ((DateTime)value).ToString("yyyy-MM-dd");
        }

        public void Default(User user, out string text, out object value)
        {
            DateTime now = DateTime.Now;
            text = now.ToString("yyyy-MM-dd");
            value = now;
        }
    }
}
